package com.carlos.company.aspect;

import com.carlos.company.annotation.Print;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Scanner;

/**
 * @author 李健成
 * @date 2021/10/20
 */

@Aspect
@Component
public class TestAspect {

    @Pointcut(value = "@annotation(print)")
    public void pointCut(Print print) {}

    @Before(value = "pointCut(print)", argNames = "print")
    public void before(Print print) {
        System.out.println(print.value());
    }

}
